import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Layout from './components/layout/Layout';
import RequireAuth from './components/auth/RequireAuth.jsx';
import Home from './pages/home/Home';
import Profile from './pages/profile/Profile';
import './styles/theme.css';
import { initTheme } from './utils/theme';
import OAuthRedirect from './components/auth/OAuthRedirect.jsx';

// 引入TDesign样式
import 'tdesign-react/es/style/index.css';
// 引入全局样式（隐藏滚动条、平滑滚动等）
import './styles/global.css';

function WebApp() {
  React.useEffect(() => { initTheme(); }, []);
  return (
    <Router>
      <Layout>
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/profile" element={<RequireAuth><Profile /></RequireAuth>} />
          <Route path="/oauth/callback/:provider" element={<OAuthRedirect />} />
        </Routes>
      </Layout>
    </Router>
  );
}


export default WebApp;
